<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var obj = {
            brand:'华为',
            price:2998.98,
            cpu:'麒麟990'
        };
        Object.defineProperty(obj,'color',{
            value:'red',
            enumerable:true
        });
        console.log(obj);
        // 设置属性不允许修改
        Object.defineProperty(obj,'price',{
            writable:false
        });
        obj.price = 1000;
        console.log(obj);
    </script>
</body>
</html>